﻿namespace com.crownpack
{
    using System.Linq;

    using com.crownpack.Extensions.SymbolExtensions;
    using com.crownpack.SharePoint;

    using Microsoft.SharePoint;

    public class Initiatives_Definition_SiteLevel : CustomBaseDefinition
    {
        #region Fields

        const string SITECOLUMNS = "Initiatives.xml";

        #endregion Fields

        #region Constructors

        public Initiatives_Definition_SiteLevel( SPFeatureReceiverProperties properties )
            : base(properties)
        {
        }

        ~Initiatives_Definition_SiteLevel( )
        {
            Dispose( false );
        }

        #endregion Constructors

        #region Methods

        public override void Create( )
        {
            base.Create( );
            CreateSiteColumns( GetFieldDefinitionsAsXml( SITECOLUMNS ) );
        }

        public override void Delete( )
        {
            base.Delete( );
            DeleteSiteColumns( GetFieldDefinitionsAsXml( SITECOLUMNS ) );
        }

        #endregion Methods

        #region Other

        //ContentTypeDefn getContentTypeDefn( )
        //{
        //    ReferenceObject c = null;
        //    return new ContentTypeDefn
        //    {
        //        Name = Item.GetContentTypeName<ReferenceObject>( ),
        //        ContentTypeId = Item.GetContentTypeId<ReferenceObject>( ),
        //        Group = "com.crownpack",
        //        Description = "Defines the export configuration.",
        //        Fields = new FieldDefn[ ]
        //        {
        //            new FieldDefn{ Name = Item.GetColumnName<ReferenceObject>( c.GetPropertySymbol( o=> o.Active ))},
        //            new FieldDefn{ Name = Item.GetColumnName<ReferenceObject>( c.GetPropertySymbol( o=> o.ExportType ))},
        //            new FieldDefn{ Name = Item.GetColumnName<ReferenceObject>( c.GetPropertySymbol( o=> o.DocumentName )), Required = true },
        //            new FieldDefn{ Name = Item.GetColumnName<ReferenceObject>( c.GetPropertySymbol( o=> o.DocumentLibrary )), Required = true },
        //            new FieldDefn{ Name = Item.GetColumnName<ReferenceObject>( c.GetPropertySymbol( o=> o.Header ))},
        //            new FieldDefn{ Name = Item.GetColumnName<ReferenceObject>( c.GetPropertySymbol( o=> o.List )), Required = true },
        //            new FieldDefn{ Name = Item.GetColumnName<ReferenceObject>( c.GetPropertySymbol( o=> o.IncludeAuthor ))},
        //            new FieldDefn{ Name = Item.GetColumnName<ReferenceObject>( c.GetPropertySymbol( o=> o.IncludeContentType ))},
        //            new FieldDefn{ Name = Item.GetColumnName<ReferenceObject>( c.GetPropertySymbol( o=> o.IncludeCreated ))},
        //            new FieldDefn{ Name = Item.GetColumnName<ReferenceObject>( c.GetPropertySymbol( o=> o.IncludeEditor ))},
        //            new FieldDefn{ Name = Item.GetColumnName<ReferenceObject>( c.GetPropertySymbol( o=> o.IncludeItemUrl ))},
        //            new FieldDefn{ Name = Item.GetColumnName<ReferenceObject>( c.GetPropertySymbol( o=> o.IncludeModified ))},
        //            new FieldDefn{ Name = Item.GetColumnName<ReferenceObject>( c.GetPropertySymbol( o=> o.IncludeUniqueId ))},
        //            new FieldDefn{ Name = Item.GetColumnName<ReferenceObject>( c.GetPropertySymbol( o=> o.ResetLastExport ))},
        //            new FieldDefn{ Name = Item.GetColumnName<ReferenceObject>( c.GetPropertySymbol( o=> o.LastExport )), Hidden = true },
        //            new FieldDefn{ Name = Item.GetColumnName<ReferenceObject>( c.GetPropertySymbol( o=> o.Title )), Hidden = true, BaseColumn = true },
        //        }.Distinct( ).ToList( )
        //    };
        //}

        #endregion Other
    }
}